<template>
	<view class="jcxzcf">
		
	</view>
	<view class="pl40 pt50 pr40 pm100 pr">
		<view class="display-flex">
			<view class="vertical-center dfdssdfsdfty">
				<view class="">
					<text class="iconfont icon-weibiaoti9 z3 fz40 cz"></text>
					<text class="ml10 cz fz34">标题</text>
				</view>
			</view>
			<view class="flex-1 ml20">
				<input type="text" v-model="fomsdr.title" placeholder="请输入标题" class="xzczxrterxct" />
			</view>
		</view>
		<view class="display-flex mt40">
			<view class="vertical-center dfdssdfsdfty">
				<view class="">
					<text class="iconfont icon-riqi z3 fz40 cz"></text>
					<text class="ml10 cz fz34">日期</text>
				</view>
			</view>
			<view class="flex-1 ml20">
				<picker mode="date" :value="xcxzrtta" @change="xcxctfcdt">
					<input type="text" v-model="fomsdr.riqi" disabled placeholder="请输入日期" class="xzczxrterxct" />
				</picker>
			</view>
		</view>
		<view class="display-flex mt40">
			<view class="vertical-center dfdssdfsdfty">
				<view class="">
					<text class="iconfont icon-shijian z3 fz40 cz"></text>
					<text class="ml10 cz fz34">时间</text>
				</view>
			</view>
			<view class="flex-1 ml20">
				<picker :value="xcxzrttb" mode="time" @change="xcxty">
					<input type="text" v-model="fomsdr.time" placeholder="请输入时间" disabled class="xzczxrterxct" />
				</picker>
			</view>
		</view>
		<view class="display-flex mt40">
			<view class="vertical-center dfdssdfsdfty">
				<view class="">
					<text class="iconfont icon--didian z3 fz40 cz"></text>
					<text class="ml10 cz fz34">地点</text>
				</view>
			</view>
			<view class="flex-1 ml20" @tap="kxcxdfe">
				<input type="text" disabled v-model="fomsdr.didian" placeholder="请输入地点" class="xzczxrterxct" />
			</view>
		</view>

		<view class="display-flex mt40">
			<view class="mt20 dfdssdfsdfty">
				<view class="">
					<text class="iconfont icon-beizhu z3 fz40 cz"></text>
					<text class="ml10 cz fz34">备注</text>
				</view>
			</view>
			<view class="flex-1 ml20">
				<textarea v-model="fomsdr.beizhu" class="xczxrtreytrfct" placeholder="请输入备注"></textarea>
			</view>
		</view>

		<view class="xcxzrtrxryyx vertical-center">
			<view class="fz32 fdsfsdxcrttry vertical-center" @tap="qunxcret">确定</view>
		</view>
	</view>
</template>
<script lang="ts" setup>
	import { onLoad } from "@dcloudio/uni-app"
	import { ref } from "vue"
	import { hf, dxrequest, callBack } from "@/util/index.js"
	const fomsdr = ref({
		title: "",
		riqi: "",
		time: "",
		didian: "",
		beizhu: ""//备注
	})
	const xcxzrtta = ref()
	const xcxzrttb = ref()
	onLoad(async (czsrer) => {
		uni.showLoading({
			title:"加载中..."
		})
		const { data } = await dxrequest("maya/renwu/renwu?id=" + czsrer.id)
		fomsdr.value = data
		xcxzrtta.value = data.riqi
		xcxzrttb.value = data.time
		console.log(xcxzrttb.value)
		uni.hideLoading()
	})
	const qunxcret = async () => {
		if (!fomsdr.value.time) {
			uni.showToast({
				title: "请输入标题"
			})
			return
		}
		uni.showLoading({
			title:"提交中..."
		})
		await dxrequest("maya/renwu/renwu",fomsdr.value,"put")
		uni.hideLoading()
		callBack()
	}
	const kxcxdfe = () => {
		uni.chooseLocation({
			success: function (res) {
				fomsdr.value.didian = res.address
				console.log('位置名称：' + res.name);
				console.log('详细地址：' + res.address);
				console.log('纬度：' + res.latitude);
				console.log('经度：' + res.longitude);
			}
		});
	}
	const xcxctfcdt = (data) => {
		fomsdr.value.riqi = data.detail.value
	}
	const xcxty = (data) => {
		fomsdr.value.time = data.detail.value
	}

</script>

<style scoped>
	
	.xzczxrterxct {
		height: 100rpx;
		border-radius: 20rpx;
		background: #FFFFFF;
		padding-left: 20rpx;
	}

	.xczxrtreytrfct {
		height: 220rpx;
		border-radius: 20rpx;
		background: #FFFFFF;
		padding: 20rpx;
		width: 100%;
	}

	.dfdssdfsdfty {
		align-items: flex-start;
		width: 140rpx;
	}

	.xcxzrtrxryyx {
		margin-top: 200rpx;
	}

	.fdsfsdxcrttry {
		width: 450rpx;
		height: 80rpx;
		border-radius: 30rpx;


	}

	.fdsfsdxcrttry {
		background-color: #D50C0C !important;
		color: #fff;
	}
</style>